package bugfix.com.eventbustest;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import java.util.ArrayList;

import bean.User;
import de.greenrobot.event.EventBus;
import eventbus.Event;


public class TestActivity extends AppCompatActivity {
    private TextView tv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv = (TextView) findViewById(R.id.tv);
        tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Event.UserListEvent userListEvent = new Event.UserListEvent();
                userListEvent.users = new ArrayList<User>();
                userListEvent.users.add(new User("小白", "男"));
                userListEvent.users.add(new User("小路", "男"));
                userListEvent.users.add(new User("小花", "女"));
                EventBus.getDefault().post(userListEvent);
                TestActivity.this.finish();
            }
        });
    }
}
